@include("home.layouts.header")
@if ($banner_list)
    <div class="ban_innder" style="background-image: url({{ $banner_list[0] }});">
        <div class="wp">
            <div class="txt">
                律师团队
            </div>
        </div>
    </div>
@endif
<!-- 内页banner end -->
<div class="main">
    <div class="wp">
        <!-- 筛选-end -->
        <br>
        <!-- 律师 -->
        <ul class="xj-list1">
            @foreach($list['data'] as $key=>$val)
           <li>
               <a href="/lawyer/detail?id={{ $val['id'] }}">
                   <div class="pic">
                       <img src="{{ $val['images'] }}">
                   </div>
                   <div class="txt">
                       <h3>{{ $val['name'] }}</h3>
                       <p>{{ $val['type'] }}</p>
                   </div>
                   <div class="desc">
                       {{ $val['field'] }}
                       <span class="btn">查看详情</span>
                   </div>
               </a>
           </li>
            @endforeach
        </ul>
        <!-- 律师-end -->
        <!-- 分页 -->
        <ul class="g-pages" id="page">
            <li><a href="{{ $list['first_page_url'] }}" class="page-prev">&lt;</a></li>
            <li class="on"><a>1</a></li>
            @if ($list['total'] > $list['per_page'])
                @for($i=2;$i<=$list['last_page'];$i++)
                    <li><a href="/news/index?page={{ $i }}">{{ $i }}</a></li>
                @endfor
            @endif
            <li><a href="{{ $list['next_page_url'] }}" class="page-next">&gt;</a></li>
        </ul>
        <!-- 分页end -->
    </div>
</div>
<!-- 底部 -->
<!-- 底部 end -->
<link rel="stylesheet" href="css/M_select.css">
<script src="js/M_select.js"></script>
<link href="css/jquery.select.css" rel="stylesheet">
<script src="js/jquery.select.js"></script>
<script src="js/laypage.js"></script>
<script src="js/layer.js"></script>
<script>
    var page = 0;
    var key = 1;
    var zong_count;
    // 页面加载初始化
    $(document).ready(function(){
        GetListData();
    });
    // 点击搜索加载数据API
    $('#seach_btn').click(function(){
        GetListData();
    });

    $('#reset_btn').click(function(){
        $(".m_seach .m_zm .zm a").removeClass('on')
        $(".sel:eq(0) span").html("工作城市");
        $(".sel:eq(1) span").html("业务部门");
        $(".sel:eq(2) span").html("专业资格");
        $("input[name='A_Z']").val("");
        $("input[name='case']").val("");
        $("input[name='source']").val("");
        $("input[name='zige']").val("");
        $("input[name='title']").val("");
    });

    function GetListData(){
        var orderby = $("input[name='A_Z']").val();
        var cases = $("input[name='case']").val();
        var source = $("input[name='source']").val();
        var zige = $("input[name='zige']").val();
        var title = $("input[name='title']").val();
        $.ajax({
            url: "/index.php?m=content&c=index&a=lawyer_list",
            data: {
                page: page,
                key: key,
                orderby:orderby,
                cases:cases,
                source:source,
                zige:zige,
                title:title
            },
            type: "POST",
            dataType: "JSON",
            async: false, //同步传输，并添加返回值，返回值应为已定义的全局变量 如a
            success: function(data) {
                var str = "";
                zong_count = data.zong_count;
                if(data.count == 0){
                    layer.msg('暂无相关数据');
                    str = '';
                    $('.xj-list1').html(str);
                    $(".g-pages").hide();
                } else {
                    for(var i=0;i<data.count;i++){
                        str +='<li><a target="_blank" href="'+data[i]['url']+'"><div class="pic"><img src="'+data[i]['thumb']+'" alt=""></div><div class="txt"><h3>'+data[i]['title']+'</h3><p>'+data[i]['zige']+' '+data[i]['case']+'</p></div><div class="desc">'+data[i]['keywords_html']+'<span class="btn">查看详情</span></div></a></li>';
                    }
                    $('.xj-list1').html(str);
//					    	layer.msg('查询成功');
                    laypage({
                        cont: 'page',
                        pages: Math.ceil(zong_count / 12), //可以叫服务端把总页数放在某一个隐藏域，再获取。假设我们获取到的是18
                        curr: (page + 1) || 0,
                        jump: function(e, first){ //触发分页后的回调
                            if(!first){ //一定要加此判断，否则初始时会无限刷新
                                page = e.curr - 1;
                                GetListData();
                            }
                        }
                    });
                }
            }
        });
    }
</script>
<script>
    $(function() {
        // 对下拉框进行初始化
        $(".select01").M_select();
        $(".select02").M_select();
        $(".select03").M_select();
        $(".select04").M_select();

        $('.m_zm .zm a').click(function(event) {
            page = 0;
            $(this).addClass('on').siblings('a').removeClass('on');
        });

        $('.m_seach .js_but').click(function(event) {
            page = 0;
            /* Act on the event */
            $('.m_seach .js_main').slideToggle(200);
        });

        $('.m_inp .sel span').click(function(){
            page = 0;
            $(this).siblings('dl').slideToggle().parents('.sel').siblings('.sel').removeClass('ok').find('dl').slideUp();
            $(this).parent('.m_inp .sel').toggleClass('ok');
        })
        $('.m_inp .sel dd').click(function(){
            page = 0;
            var opt = $(this).text();
            var ddval = $(this).attr("value");
            $(this).parent('dl').siblings('span').text(opt);
            $(this).parent('dl').siblings('.inp').val(ddval);
            $(this).parent('dl').slideUp();
            $(this).parents('.m_inp .sel').removeClass('ok');
        })

        $('.zm a').click(function(){
            page = 0;
            var a_z = $(this).text();
            $("input[name='A_Z']").attr('value',a_z);
        })
    });
</script>
@include("home.layouts.footer")